﻿<!DOCTYPE html>
<html lang="en">

{{include 'admin/public/head.html'}}

<body>
	<div class="navbar navbar-default" id="navbar">
		<script type="text/javascript">
			try { ace.settings.check('navbar', 'fixed') } catch (e) { }
		</script> {{include 'admin/public/nav_top.html'}}
	</div>

	<div class="main-container" id="main-container">
		<script type="text/javascript">
			try { ace.settings.check('main-container', 'fixed') } catch (e) { }
		</script>

		<div class="main-container-inner">
			<a class="menu-toggler" id="menu-toggler" href="#">
				<span class="menu-text"></span>
			</a>

			{{include 'admin/public/slide_left.html'}}

			<div class="main-content">
				<div class="breadcrumbs" id="breadcrumbs">
					<script type="text/javascript">
						try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }
					</script>

					<ul class="breadcrumb">
						<li>
							<i class="icon-home home-icon"></i>
							<a href="#">首页</a>
						</li>
						<li class="active">控制台</li>
					</ul>
					<!-- .breadcrumb -->

					<div class="nav-search" id="nav-search">
						<form class="form-search">
							<span class="input-icon">
								<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
								<i class="icon-search nav-search-icon"></i>
							</span>
						</form>
					</div>
					<!-- #nav-search -->
				</div>

				<div class="page-content">

					<div class="page-header">
						<h1>
							导航列表
						</h1>
					</div>
					<!-- /.page-header -->



					<!--表格-->

					<div class="table-responsive">
						<table id="sample-table-1" class="table table-striped table-bordered table-hover center">
							<thead>
								<tr>
									<th class="center">
										<label>
											<input type="checkbox" class="ace">
											<span class="lbl"></span>
										</label>
									</th>
									<th width="60px;" class="center">排序</th>
									<th class="center">标题</th>
									<!-- <th class="center">分类</th> -->
									<!-- <th class="hidden-480 center">点击量</th> -->
									<th class="center">链接地址</th>
									<th class="center">状态</th>
									<th class="center">更新日期</th>

									<th width="100px;" class="center">操作</th>
								</tr>
							</thead>

							<tbody>
								{{each list}}
								<tr class="center">
									<td class="">
										<label>
											<input type="checkbox" class="ace">
											<span class="lbl"></span>
										</label>
									</td>

									<td>
										<input type="text" value="{{$value.sort || 0}}" class="sort_input" style='width:100px;' onblur="app.changeSort(this,'nav','{{@$value._id}}')"
										/>

									</td>

									<td style="">
										{{$value.title}}
									</td>

									

									<td style="">
										<a target="view_window" href="{{$value.url}}">{{$value.url}}</a>
									</td>

									<td class="hidden-480 ">
										{{if $value.status=="1"}}
										<button class="btn btn-xs btn-success" onclick="app.toggle(this,'nav','status','{{@$value._id}}')">
											<i class="icon-ok bigger-120 success"></i>
										</button>
										{{else}}
										<button class="btn btn-xs" onclick="app.toggle(this,'nav','status','{{@$value._id}}')">
											<i class="icon-remove bigger-120 "></i>
										</button>

										{{/if}}
									</td>

									{{if $value.add_time }}
									<td style="">
										{{$value.add_time | dateFormat}}
									</td>
									{{else}}
									<td style="">

									</td>
									{{/if}}



									<td>
										<div class="visible-md visible-lg hidden-sm hidden-xs btn-group center">

											<a href="{{__HOST__}}/admin/nav/edit?id={{@$value._id}}">

												<button class="btn btn-xs btn-info">
													<i class="icon-edit bigger-120"></i>
												</button>

											</a>


											<a class="del" href="{{__HOST__}}/admin/del?collection=nav&id={{@$value._id}}">
												<button class="btn btn-xs btn-danger">
													<i class="icon-trash bigger-120"></i>
												</button>
											</a>
										</div>

									</td>
								</tr>


								{{/each}}



							</tbody>
						</table>

						<div id='page' class="pagination"></div>

					</div>

				</div>
			</div>
			<!-- /.main-content -->

		</div>
		<!-- /.main-container-inner -->

		<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
			<i class="icon-double-angle-up icon-only bigger-110"></i>
		</a>
	</div>
	<!-- /.main-container -->


	<!--[if !IE]> -->

	<script type="text/javascript">
		window.jQuery || document.write("<script src='{{__HOST__}}/admin/js/jquery-2.0.3.min.js'>" + "<" + "script>");
	</script>

	<!-- <![endif]-->

	<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"script>");
</script>
<![endif]-->

	<script type="text/javascript">
		if ("ontouchend" in document) document.write("<script src='{{__HOST__}}/admin/js/jquery.mobile.custom.min.js'>" + "<" + "script>");
	</script> {{include 'admin/public/foot.html'}}

	<script src="{{__HOST__}}/admin/jqPaginator.js"></script>

	<script>
		// $('#page').jqPaginator({
		// 	totalPages: {{ totalPage }},
		// 	visiblePages: 10,
		// 	currentPage: {{ page }},
		// 	onPageChange: function (num, type) {
		// 		$('#text').html('当前第' + num + '页');
		// 		console.log(type)
		// 		if (type == 'change') {
		// 			location.href = '{{__HOST__}}/admin/article?page=' + num
		// 		}

		// 	}
		// })

	</script>

	<script type="text/javascript">
		jQuery(function ($) {


			$('table th input:checkbox').on('click', function () {
				var that = this;
				$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function () {
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});

			});


			$('[data-rel="tooltip"]').tooltip({ placement: tooltip_placement });
			function tooltip_placement(context, source) {
				var $source = $(source);
				var $parent = $source.closest('table')
				var off1 = $parent.offset();
				var w1 = $parent.width();

				var off2 = $source.offset();
				var w2 = $source.width();

				if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
				return 'left';
			}
		})
	</script>

</body>

</html>